<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
	<head>
		<base href="<%=basePath%>"/>
		<meta charset="utf-8" />
		<title>Document</title>
		<style type="text/css">
			form{
				width:320px;
				margin:0px auto;
			}
			div{
				overflow:hidden;
			}
			div p{
				float:left;
			}
			div input{
				height:25px;
				margin-top:13px;
				
				border:1px solid #000;
			}
			div select{
				height:25px;
				width:115px;
				margin-top:13px;
				
				border:1px solid #000;
			}
			form p.c{
				padding-left:25px;
			}
			form p.c input{
				margin-top:20px;
				color:#fff;
				background-color:#B87354;
				padding-right:10px;
				cursor: pointer;
				border:0px;
				border-radius:5px;
				width:80px;
				height:30px;			
			}
			form p.c input:hover{
				background-color: #AA895E;
			}
			form .shopppicture input{
				border:0px;
			}
		</style>
		
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript">
			$(function(){
				var yiji=$("#yiji").val();
				$.post("erjimenu.shtml",{"yiji":yiji},function(data){
					var namearr=data.split(",");
					
					for(var i=0;i<namearr.length-1;i++){
						var namee=namearr[i];
						var nam=namee.substring(0,namee.indexOf("."));
						var nameid=namee.substring(namee.indexOf(".")+1,namee.length);

						$("#erji").append("<option value='"+nameid+"'>"+nam+"</option>");
					}
				});
				
				$("#yiji").bind("change",function(){
					$("#erji").empty();
					var yiji=$(this).val();
					$.post("erjimenu.shtml",{"yiji":yiji},function(data){
						var namearr=data.split(",");						
						for(var i=0;i<namearr.length-1;i++){
							var namee=namearr[i];
							var nam=namee.substring(0,namee.indexOf("."));
							var nameid=namee.substring(namee.indexOf(".")+1,namee.length);
							$("#erji").append("<option value='"+nameid+"'>"+nam+"</option>");
						}
					});
				});
			});
		</script>
		
	</head>
	<body>
	<%@ include file="/HT/login_control.jsp" %>
			<h1 style="text-align: center">增加商品</h1>
			<form action="addshopping.shtml" method="post"  enctype="multipart/form-data">
				<div class="shoppyiji">
					<p>请选择一级菜单：</p>
					<select name="yiji" id="yiji">
					<c:forEach items="${list }" var="yiji">
						<option value="${yiji.n_id }">${yiji.n_name }</option>
					</c:forEach>
					</select>
				</div>
				<div class="shopperji">
					<p>请选择二级菜单：</p>
					<select name="erjimenu" id="erji">
					<c:forEach items="${listmenu }" var="menu">
						<option value="${menu.m_id }"></option>
					</c:forEach>
					</select>
				</div>
				
				<div class="shoppname">
					<p>商品名称：</p>
					<input type="text" name="shoppname">
				</div>
				<div class="shoppprice">
					<p>商品价格：</p>
					<input type="text" name="shoppprice">
				</div>
				<!-- <div class="shoppnum">
					<p>商品数量：</p>
					<input type="text" name="shoppnum">
				</div> -->
				<div class="shopppicture">
					<p>商品图片：</p>
					<input type="file" name="picture">
				</div>
				<div>
					<p class="c"><input type="submit" value="提交">&emsp;&emsp;<input type="reset" value="重置"></p>
				</div>
			</form>
	</body>
</html>
